package guava;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;

import java.util.Map;
import java.util.Set;

/**
 * @author Daniel
 */
public class TableTest {

    public static void main(String[] args) {

        Table<String, String, Integer> table = HashBasedTable.create();

        table.put("赵", "计算机", 80);
        table.put("赵", "数学", 90);
        table.put("钱", "数学", 80);
        table.put("钱", "计算机", 70);

        Set<Table.Cell<String, String, Integer>> cells = table.cellSet();
        cells.forEach(stringStringIntegerCell -> System.out.println("stringStringIntegerCell = " + stringStringIntegerCell));

        Set<String> rowKeySet = table.rowKeySet();
        System.out.println("rowKeySet = " + rowKeySet);

        Set<String> columnKeySet = table.columnKeySet();
        System.out.println("columnKeySet = " + columnKeySet);

        Map<String, Integer> row = table.row("钱");
        System.out.println("row = " + row);

        Map<String, Integer> column = table.column("计算机");
        System.out.println("column = " + column);
    }

}
